package algorithm.lanqiao.t19709;

import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.StreamTokenizer;


public class Main {
    static InputStreamReader ins = new InputStreamReader(System.in);
    static StreamTokenizer in = new StreamTokenizer(ins);
    static PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) {
        int[] table = new int[]{5, 5 * 4, 5 * 5 * 5, 5 * 5 * 5 * 4, 5 * 5 * 5 * 5 * 5, 5 * 5 * 5 * 5 * 5 * 4, 5 * 5 * 5 * 5 * 5 * 5 * 5, 5 * 5 * 5 * 5 * 5 * 5 * 5 * 4};
        int n = readInt();
        String str = String.valueOf(n);
        int len = str.length();
        int ans = 0;
        if (len > 1) {
            for (int i = 0; i <= len - 2; i++) {
                ans += table[i];
            }
        }
        int nowIdx = len;
        int cnt = 1;
        for (int i = 0; i < len; i++) {
            int num = str.charAt(i) - '0';
            int valNum = 0;
            if (nowIdx % 2 == 0) {
                for (int j = nowIdx == len ? 1 : 0; j <= num; j++) {
                    if (j % 2 == 0) valNum++;
                }
            } else {
                for (int j = 1; j <= num; j++) {
                    if (j % 2 != 0) valNum++;
                }
            }
            nowIdx--;
            cnt *= valNum;
        }
        ans += cnt;
        out.println(ans);
        out.flush();
    }

    private static int readInt() {
        try {
            in.nextToken();
        } catch (Exception e) {
        }

        return (int) in.nval;
    }
}
